Results

Imports

library(stargazer)
library(tidyverse)
library(patchwork)
library(plotly)
load("data/models.RData")
wahl_lohn <- readRDS("data/wahl_lohn_mod.rds")

Plots

Basic plot with SB

plot_basic <- ggplot(aes(x = lohn_prozent, y = afd_prozent, label=name), data = wahl_lohn) +
  geom_point(shape = 1) +
  geom_smooth(method = "lm", se = T) +
  labs(
    x = "Minimum Wage Share",
    y = "AfD Vote Share",
    subtitle = "District Level",
    caption = "Data: WSI, Bundeswahlleiter"
  ) +
  theme_gray() #+ #scientific theme
  #coord_cartesian(xlim = c(0, 0.5), ylim = c(0, 0.35)) + #start at 0,0
  # for Sonneberg (16072)
  # geom_point(
  #   data = wahl_lohn %>% filter("kreis" == "16072"),
  #   color = "red",
  # ) + 
  # geom_text(
  #   data = wahl_lohn %>% filter("kreis" == "16072"),
  #   label = "SB",
  #   vjust = 1.3,
  #   hjust = 0,
  #   color = "red"
  # )
ggsave("images/plot_basic.png", plot_basic, width = 10, height = 7)
`geom_smooth()` using formula 'y ~ x'
#plotly::ggplotly(plot_basic)
plot_basic
`geom_smooth()` using formula 'y ~ x'

Plot with east germany

ggplot(aes(x = lohn_prozent, y = afd_prozent), data = wahl_lohn) +
  geom_point(aes(color = factor(ost))) +
  geom_smooth(method = "lm") +
  labs(
    x = "Anteil Mindestlohnbezieher",
    y = "AfD Stimmen in %",
    title = "AfD Stimmen und Mindestlohnbezieher",
    subtitle = "Kreisebene",
    caption = "Daten: WSI, Bundeswahlleiter"
  ) +
  scale_color_manual(values = c("red", "blue"), name="Osten") + #color of points
  theme_minimal() + #scientific theme
  coord_cartesian(xlim = c(0, 0.5), ylim = c(0, 0.35))  #start at 0,0
`geom_smooth()` using formula 'y ~ x'

Plot with scale for arbeitslosenquote

ggplot(aes(x = lohn_prozent, y = afd_prozent), data = wahl_lohn) +
  geom_point(aes(color = arbeitslosenquote)) +
  geom_smooth(method = "lm") +
  labs(
    x = "Anteil Mindestlohnbezieher",
    y = "AfD Stimmen in %",
    title = "AfD Stimmen und Mindestlohnbezieher",
    subtitle = "Kreisebene",
    caption = "Daten: WSI, Bundeswahlleiter"
  ) +
  scale_color_viridis_c(name = "Arbeitslosenquote", option="magma", direction=-1) + #color of points
  theme_minimal() + #scientific theme
  coord_cartesian(xlim = c(0, 0.5), ylim = c(0, 0.35))  #start at 0,0
`geom_smooth()` using formula 'y ~ x'

Plot for linkspartei

ggplot(aes(x = lohn_prozent, y = linke_prozent), data = wahl_lohn) +
  geom_point() +
  geom_smooth(method = "lm") +
  theme_minimal() #scientific theme
`geom_smooth()` using formula 'y ~ x'
Warning: Removed 1 rows containing non-finite values (stat_smooth).
Warning: Removed 1 rows containing missing values (geom_point).

Maps

Load GEOJSON Data for Kreise

Data Source = Regionalatlas Statistikportal

spdf <- sf::read_sf("data/kreise.geojson")

Merge

geodata <- spdf %>% 
  left_join(wahl_lohn, by = c("schluessel" = "kreis"))

Afd Stimmen

afd_map <- ggplot(geodata) +
  geom_sf(aes(fill = afd_prozent)) +
  scale_fill_viridis_c(name = "AfD in %", option="magma", direction=-1) +
  theme_minimal() +
  labs(
    title = "AfD Vote Share",
    subtitle = "District Level",
    caption = "Data: Bundeswahlleiter"
  )

Mindestlohn

lohn_map <- ggplot(geodata) +
  geom_sf(aes(fill = lohn_prozent)) +
  scale_fill_viridis_c(name = "MW %", option="magma", direction=-1) +
  theme_minimal() +
  labs(
    title = "Minimum Wage Recipients",
    subtitle = "District Level",
    caption = "Data: WSI"
  )

both maps next to each other

maps <- afd_map + lohn_map
ggsave("images/maps.png",plot=maps, width = 10, height = 5)
subplot(ggplotly(afd_map), ggplotly(lohn_map))

Regression Models Table

Summary Statistic of Data

stargazer(as.data.frame(wahl_lohn %>% subset(select = -foreigners)), type="html")
Statistic N Mean St. Dev. Min Max
afd_prozent 400 0.113 0.058 0.029 0.321
lohn_prozent 400 0.194 0.064 0.079 0.440
linke_prozent 399 0.045 0.029 0.015 0.155
ost 400 0.190 0.393 0 1
arbeitslosenquote 400 0.052 0.022 0.019 0.148
gdp 400 40,329.500 16,743.150 17,553 158,749
age 400 45.277 2.008 40.700 51.000
pop 400 536.540 708.669 35.300 4,788.200

output to latex / html for inclusion in report

stargazer(as.data.frame(wahl_lohn %>% subset(select = -foreigners)), type="latex", out="images/summary_table.tex", header = FALSE)
stargazer(as.data.frame(wahl_lohn %>% subset(select = -foreigners)), type="html", out="images/summary_table.html", header = FALSE)

Compile List of Models to include in Table

models <- list(
  model_basic,
  model_ost,
  model_arbeit,
  model_gdp,
  model_age,
  model_pop
)

Create the Stargazer Table

Table 1
table <- stargazer(models, 
          type = "html", #change to text for coding
          title = "Effect of Minimum Wage Recipients on AfD Vote Share",
          dep.var.labels = "AfD Vote Share",
          covariate.labels = c(
            "Minimum Wage Rate", 
            "East Germany",
            "Unemployment Rate", 
            "Log GDP p. C.", 
            "Avg. Age", 
            "Log Pop. Density"
            ),
          df = F,
          omit.stat = c("rsq", "f")
          )
Effect of Minimum Wage Recipients on AfD Vote Share
Dependent variable:
AfD Vote Share
(1) (2) (3) (4) (5) (6)
Minimum Wage Rate 0.714*** 0.291*** 0.308*** 0.301*** 0.227*** 0.220***
(0.028) (0.039) (0.039) (0.044) (0.044) (0.044)
East Germany 0.086*** 0.088*** 0.088*** 0.081*** 0.082***
(0.006) (0.006) (0.006) (0.006) (0.006)
Unemployment Rate -0.279*** -0.275*** -0.244*** -0.163*
(0.071) (0.072) (0.070) (0.093)
Log GDP p. C. -0.002 0.011* 0.013**
(0.005) (0.006) (0.006)
Avg. Age 0.006*** 0.006***
(0.001) (0.001)
Log Pop. Density -0.003
(0.002)
Constant -0.026*** 0.040*** 0.051*** 0.071 -0.332*** -0.315***
(0.006) (0.007) (0.007) (0.060) (0.091) (0.092)
Observations 400 400 400 400 400 400
Adjusted R2 0.612 0.732 0.742 0.741 0.760 0.761
Residual Std. Error 0.036 0.030 0.030 0.030 0.029 0.029
Note: p<0.1; p<0.05; p<0.01

output it to latex / html for inclusion in Report

stargazer(models, 
          type = "latex",
          out= "images/table.tex",
          header = FALSE,
          title = "Effect of Minimum Wage Recipients on AfD Vote Share",
          dep.var.labels = "AfD Vote Share",
          covariate.labels = c(
            "Minimum Wage Rate", 
            "East Germany",
            "Unemployment Rate", 
            "Log GDP p. C.", 
            "Avg. Age", 
            "Log Pop. Density"
            ),
          df = F,
          omit.stat = c("rsq", "f")
          )

stargazer(models, 
          type = "html",
          out= "images/table.html",
          header = FALSE,
          title = "Effect of Minimum Wage Recipients on AfD Vote Share",
          dep.var.labels = "AfD Vote Share",
          covariate.labels = c(
            "Minimum Wage Rate", 
            "East Germany",
            "Unemployment Rate", 
            "Log GDP p. C.", 
            "Avg. Age", 
            "Log Pop. Density"
            ),
          df = F,
          omit.stat = c("rsq", "f")
          )

Rewrite this code with table package gt